<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      >
    <h:body>

        <ui:composition template="/WEB-INF/templates/commonLayout.xhtml">

            <ui:define name="content">
                <div>
                    <h:form id="uploadForm" enctype="multipart/form-data">  
                        <p:fileUpload id="fileUpload" fileUploadListener="#{fileUploadBackingBean.handleFileUpload}"  
                                      mode="advanced"   
                                      update="messages"  
                                      sizeLimit="1000000"   
                                      allowTypes="/(\.|\/)(txt)$/"
                                      styleClass="fileChooser" disabled="#{!fileUploadBackingBean.setLevensteinParameters}"
                                      />  

                        <p:growl id="messages" showDetail="true"/> 
                    </h:form> 
                </div>

                <h:form > 
                    <p:panel id="panel" header="Levenshtein Distance">  
                        <p:messages id="msgs"/>  
                        <br/>
                        <h:panelGrid columns="2" columnClasses="leftColumn,rightColumn" >
                            <h:outputLabel for="distance" value="Distance:" style="font-weight:bold"/>  
                            <p:inputText disabled="#{fileUploadBackingBean.setLevensteinParameters}" id="distance" label="Distance" value="#{factoryService.problem.value}" required="true" validatorMessage="Distance value is mandatory">
                                <f:convertNumber integerOnly="true" type="number"/>
                            </p:inputText>

                            <h:outputLabel for="pattern" value="Pattern:" style="font-weight:bold"/>  
                            <p:inputText disabled="#{fileUploadBackingBean.setLevensteinParameters}" id="pattern" label="Pattern" value="#{factoryService.problem.value}" required="true"/>
                        </h:panelGrid>
                        <div>
                            <p:commandButton styleClass="runSchedulerBT" value="Set parameters" action="#{fileUploadBackingBean.enableLevensteinDataUpload()}" update="panel"/>
                        </div>

                    </p:panel>   
                </h:form>
            </ui:define>
        </ui:composition>

    </h:body>

</html>